import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

//字体请求
import './common/font/font.css'
import './assets/common.css'
import './assets/css/reset.css'; //样式重置
import { obj } from './assets/js/rem'; //自适应
import 'font-awesome/css/font-awesome.min.css'; //字体库
import VueQriously from 'vue-qriously';
import vueQr from 'vue-qr';
import qs from 'qs'

//尝试添加在url加入token功能start
//设置路径的默认前缀
axios.defaults.baseURL = "http://192.168.1.100:8086"
//设置axios请求的拦截器
axios.interceptors.request.use(config=>{
  //从localStorage获取令牌
  var token = localStorage.getItem("token");
  //判断是否获取token
  if (token){
    //把token放入请求头中
    config.headers.token=token;
  }
  return config;
})
//把axios挂载到vue对象
Vue.prototype.$http = axios;
//尝试添加在url加入token功能end

Vue.use(VueQriously)
//axios 异步请求
import axios from 'axios';
import VueAxios from 'vue-axios';
Vue.use(VueAxios, axios);

//vant
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);

// 引入swiper
import { Swipe, SwipeItem } from 'vant';

Vue.use(Swipe);
Vue.use(SwipeItem);

//map
import BaiduMap from 'vue-baidu-map'

Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'd44oHULzxHzBFFRqjGnIyhLb2AVe6ATO'
})

//引入筛选下拉框
import { DropdownMenu, DropdownItem } from 'vant';
Vue.use(DropdownMenu);
Vue.use(DropdownItem);

Vue.config.productionTip = false;


import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}
new Vue({
  router,
  store,
  mounted() {
    // 自适应
    obj.setRem();
    window.onresize = obj.setRem;
    //this.$router.push('/login')
  },
  render: h => h(App)
}).$mount('#app')
